/**
 * 兼容支持placeholder
 * @namespace bs.placeholder
 */
bs.placeholder = function(){
    //检测
     function _check () {
        return 'placeholder' in document.createElement('input');
    }
    //初始化
    function _init() {
        if (!_check()) {
            _fix();
        }
    };

    //修复
    function _fix() {
        jQuery(':input[placeholder]').each(function (index, element) {
            var self = $(this), txt = self.attr('placeholder');
            self.wrap($('<div></div>').css({position: 'relative', zoom: '1', border: 'none', background: 'none', padding: 'none', margin: 'none', 'vertical-align':'middle'}));
            var pos = self.position(), h = self.outerHeight(true), paddingleft = self.css('padding-left');
            var holder = $('<span></span>').text(txt).css({position: 'absolute', left: pos.left, top: pos.top, height: h, lienHeight: h, paddingLeft: paddingleft, color: '#aaa', 'vertical-align': 'middle'}).appendTo(self.parent());
            self.focusin(function (e) {
                holder.hide();
            }).focusout(function (e) {
                if (!self.val()) {
                    holder.show();
                }
            });
            holder.click(function (e) {
                holder.hide();
                self.focus();
            });
        });
    };
    _init();
}